package ciyuan.Item.Tools;

import ciyuan.Item.ItemGroups;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTier;
import net.minecraft.item.PickaxeItem;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.world.World;

/**
 * @author 150149
 */
public class FlintPickAxe extends PickaxeItem {

    public FlintPickAxe() {
        super(ItemTier.WOOD, 2, -3.2F, new Properties().tab(ItemGroups.Tools).durability(100).defaultDurability(100));
    }

    @Override
    public ActionResult<ItemStack> use(World world, PlayerEntity playerEntity, Hand hand) {
        if (this.getDamage(playerEntity.getItemInHand(hand))>=100) {
            return ActionResult.fail(playerEntity.getItemInHand(hand));
        }
        return ActionResult.pass(playerEntity.getItemInHand(hand));
    }

    @Override
    public ItemStack finishUsingItem(ItemStack itemStack, World p_77654_2_, LivingEntity p_77654_3_) {
        if (this.getDamage(itemStack)<100) {
            this.setDamage(itemStack,this.getDamage(itemStack)+1);
        }
        return itemStack;
    }



}
